package com.kczd.jinlan.adapter.normaladapter;

import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.kczd.jinlan.R;
import com.kczd.jinlan.model.Whole;

import java.util.List;

/**
 * zhangy
 * Created by Administrator on 2017/5/21.
 */

public class DaipeisongAdapter extends BaseCommAdapter<Whole> {

    public DaipeisongAdapter(List<Whole> datas) {
        super(datas);
    }

    @Override
    protected void setUI(ViewHolder holder, int position, final Context context) {

        Whole quanbu = getItem(position);
        ImageView image_item_titleMp = holder.getItemView(R.id.daizhifu_id_img);
        image_item_titleMp.setImageResource(quanbu.titleMp);

        TextView text_title_id = holder.getItemView(R.id.daizhifu_title_id);
        text_title_id.setText(quanbu.title_id);

        TextView text_number = holder.getItemView(R.id.daizhifu_id_count);
        text_number.setText(quanbu.number);

        TextView text_price = holder.getItemView(R.id.daizhifu_id_price);
        text_price.setText(quanbu.price);

        TextView text_place_time = holder.getItemView(R.id.daizhifui_id_time);
        text_place_time.setText(quanbu.placetime);

        TextView text_total = holder.getItemView(R.id.daizhifu_id_sum);
        text_total.setText(quanbu.total);

        Button but_cancel = holder.getItemView(R.id.daizhifu_id_cancle);
        but_cancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(context, "but_cancel", Toast.LENGTH_SHORT).show();
            }
        });

        Button but_payment = holder.getItemView(R.id.daizhifu_id_ok);
        but_payment.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(context, "but_payment", Toast.LENGTH_SHORT).show();
            }
        });
    }

    @Override
    protected int getLayoutId() {
        return R.layout.item_list_daipeisong;

    }
}
